<?php
/**
 * \file    questionfb.php
 * \author  Manori, Surabhi
 * \date    May 10, 2010
 * \version 1.0
 */
?>
<?php
session_start();
require('../basicInfo/user.php');
require('question.php');
require('feedback.php');
$_SESSION['currentPage'] = "questionbank";

if(isset($_SESSION['userinfo'])) {
    
   $userinfo=unserialize($_SESSION['userinfo']);
}else {
  header("Location:../../index.php");
}

?>
<?PHP

function getQuestionInformation($qid){
	$questionInfo = QuestionController::getQuestionInfo($qid);	
}

if ($_GET['page'] == "") {
    $_GET['page'] = 1;
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>Debugger MMO</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-US" />
<style type="text/css"><!--
    #profile
    {
            float: left;
            width: 200px;
            height:400px;
            border: 1px solid #639684;
            margin: 8px 8px 8px 8px;
            background-color:#87CEEB;
    }

    #question_area
    {
        float: left;
	   margin: 8px 4px;
       width: 490px;
       background-color: #FFEFD5;
       border: 3px solid #d5c8a4;
    }

	#question_area table
    {
        width:95%;
		height:65%;
		border:1px solid #BC8F8F;
        padding: 8px;
        margin:20px 12px 12px 12px;

    }

    #question_area table tbody tr #c2
    {
        background-color: #FFE682;         

    }
	#question_area table thead tr #c1
    {
        background-color: #BC8F8F;        

    }

	#question_area table thead tr #c2
    {
        width:40%;
		background-color: #FFDB4D;        

    }

	#feedback_area table {
		border:none;
    }
	

	#heading1
    {
       width:490px;
        height:15px;
        margin-top:0px;
        background-color:#BC8F8F;
        font-family:Verdana;
        text-align:left;
        color: white;
        font-size:10px;
    }

	#feedback_area 
    {
        float:left;
        width:496px;
          margin: 8px 4px;
        border:1px solid #639684;
        background-color: #C2C2FF;

    }
	#feedback_area table tr.alt
	{
		background-color:#ffffff;
	}
	#heading2
    {
        width:490px;
        height:15px;
        margin-top:0px;
        background-color:#8888B2;
        font-family:Verdana;
        text-align:left;
        color: white;
        font-size:10px;
    }
	
    #approvebutton
    {
		color: #1B6F1B;
        background-color:#FFDB4D;
        float: left;
		padding:5px 5px 5px 5px;
        cursor: pointer;
		font-family: Verdana;
		font-size: 10px;
		font-weight:bold;
    }

	#rejectbutton
    {
		color: #FF0000;
        background-color:#FFDB4D;
        float: left;
		padding:5px 5px 5px 5px;        
		cursor: pointer;
		font-family: Verdana;
		font-size: 10px;
		font-weight:bold;
    }
    

    
    --></style>

</head>
    <body>
<?php include "../../layout/header.php"; ?>
<?php include "../../layout/navleft.php"; ?>
        <div id="question_area">
                    <div id="heading1">VIEW YOUR QUESTION</div>
		<table border="1" cellpadding="8px"  rules="columns" >
            <tr id="c1"><b>QUESTION</b></tr>
        
		    <tr >
                <?php
				echo '<br />';
				$idquestion= $_GET['qid'] ;
				$questionArr=QuestionController::getQuestionInfo($idquestion);
				$first="disabled";
				$second="disabled";
				$third="disabled";
				$fourth="disabled";
                if($questionArr[0]->getAnswer() == 'first')
				   $first="checked";
				else if ($questionArr[0]->getAnswer() == 'second')
				       $second="checked";
				else if ($questionArr[0]->getAnswer() == 'third')
				       $third="checked";
				else if ($questionArr[0]->getAnswer() == 'fourth')
				       $fourth="checked";
				
		echo $questionArr[0]->getQuestion().'<br />';
		echo '<input type="radio" name="status" value="ch1" '.$first.' size="20px"/>'.
		     $questionArr[0]->getFirst().'<br />'.
		'<input type="radio" name="status" value="ch2" '.$second.' size="20px" />'.
		     $questionArr[0]->getSecond().'<br />'.
			 '<input type="radio" name="status" value="ch3" '.$third.' size="20px"/>'.
			 $questionArr[0]->getThird().'<br />'.
			 '<input type="radio" name="status" value="ch4" '.$fourth.' size="20px"/>'.
			 $questionArr[0]->getFourth().'<br />'.
                '<br /><tr id="c2"><b>QUESTION RELATED DETAILS</b></tr><br />  ' .
                '<tr id="c2"><b>Question ID:</b> ';
				echo $questionArr[0]->getQuestId().'<br />';
				$questionTID=$questionArr[0]->getTid();
                $course=QuestionController::getQuestionCourse($questionTID);
				echo    '<b>Course:</b>        '.$course.'<br />'.
					'<b>Level:</b>         '.$questionArr[0]->getLevel().'<br />'.
					'<b>Type:</b>         '.$questionArr[0]->getQType().'<br />'.
                    '<b>Timelimit in seconds:</b> '.$questionArr[0]->getTime().'<br />'.
					'<b>Date:</b>          '.$questionArr[0]->getQDate().'<br />'.
					'<b>Status:</b>        '.$questionArr[0]->getStatus().'<br />'.
					'<b>Gold value:</b>    '.$questionArr[0]->getGold();
				
				echo '</tr>';
				?>
            </tr>        
           
           
           <?php if($userinfo->getRole()=="V"){?>
           
            <tr>
              <td>
                <form action="validatequestions.php" method="POST">
                  <input type="hidden" name="qid" value="<?php echo ($questionArr[0]->getQuestId());?>"/>
                  
                  <input type="hidden" name="uid" value="<?php echo ($userinfo->getUid());?>"/>
                  
                  <input type="hidden" name="page"/>
                  <input type="submit" id="approvebutton" name="approve" value="Approve"/>
                </form>
              </td>
              <td>
                <form action="validatequestions.php" method="POST">
                  <input type="hidden" name="qid" value="<?php echo($questionArr[0]->getQuestId());?>"/>
                  <input type="submit" id="rejectbutton" name="reject" value="Reject"/>
                </form>
              </td>
            </tr>
            
            <?php }?>
        </table>

					

					     
		</div>
		


<?php include "../../layout/navright.php"; ?>
<?php include "../../layout/footer.php"; ?>
        </body>
</html>